package br.inatel.wiiproject.main;

import wiiremotej.WiiRemote;
import wiiremotej.WiiRemoteJ;
import br.inatel.wiiproject.controller.WRLImpl;
import br.inatel.wiiproject.view.MainFrame;

public class Runner {
	
	public static void main(String[] args) {
		MainFrame.getInstance();
		
		 //basic console logging options...
        WiiRemoteJ.setConsoleLoggingAll();
        //WiiRemoteJ.setConsoleLoggingOff();
        
        try
        {
            //Find and connect to a Wii Remote
            WiiRemote remote = null;
        	WiiRemote remote2 = null;
            
            while (remote == null) {
                try {
                    remote = WiiRemoteJ.findRemote();
                }
                catch(Exception e) {
                    remote = null;
                    e.printStackTrace();
                    System.out.println("Failed to connect remote. Trying again.");
                }
            }
            
        	remote.addWiiRemoteListener(new WRLImpl(remote, true));
        	remote.setAccelerometerEnabled(true);
        	remote.setLEDIlluminated(0, true);
        	
        	while (remote2 == null) {
                try {
                    remote2 = WiiRemoteJ.findRemote();
                }
                catch(Exception e) {
                    remote2 = null;
                    e.printStackTrace();
                    System.out.println("Failed to connect remote. Trying again.");
                }
            }

            remote2.addWiiRemoteListener(new WRLImpl(remote2, false));
            remote2.setAccelerometerEnabled(true);
            remote2.setLEDIlluminated(1, true);
        }
        catch(Exception e){e.printStackTrace();}
	}

}

/*-Dbluecove.jsr82.psm_minimum_off=true
-Dbluecove.debug=false*/